home *** CD-ROM | disk | FTP | other *** search
/ Directorty Opus 5 - Magellan 2 / Opus 5 - Magellan 2.iso / Extras / DOpus511 / dopus_pch.lha / ARexx.lha / Arexx / FIDList.dopus5 < prev    next >
Text File  |  1995-06-10  |  3KB  |  109 lines

  1. /*
  2.   $VER: FIDList.dopus5 1.2 (10.6.95)
  3.   Written by Edmund Vermeulen (edmundv@grafix.xs4all.nl).
  4.  
  5.   ARexx script for Directory Opus 5 to list all selected files in the source
  6.   with their 'FILE_ID.DIZ' description.
  7.  
  8.   Call as: <ARexx>  DOpus:arexx/FIDList.dopus5 {Qp}
  9. */
  10.  
  11. outfile='T:FIDList.txt'  /* path and filename of File ID List to generate */
  12.  
  13.  
  14. parse arg portname .
  15.  
  16. if portname='' then  /* in case they forgot */
  17.    portname='DOPUS.1'
  18. address value portname
  19.  
  20. options results
  21. options failat 21
  22.  
  23. lf='0a'x
  24.  
  25. lister query source
  26. if rc>0 then
  27.    exit
  28. parse var result handle .  /* only need first source */
  29.  
  30. lister set handle busy on
  31.  
  32. lister query handle path
  33. srcpath=result
  34.  
  35. lister query handle selfiles stem files.
  36.  
  37. lister set handle progress files.count 'Making File ID List...'
  38. lister set handle title 'Making File ID List...'
  39. lister refresh handle full  
  40.  
  41. call open('output',outfile,'w')
  42. call writeln('output',"File ID List of '"srcpath"' on" date('n'))
  43. call writeln('output','')
  44.  
  45. if exists('T:FILE_ID.DIZ') then
  46.    address command 'Delete >NIL: T:FILE_ID.DIZ QUIET'
  47.  
  48. do i=0 to files.count-1
  49.    lister query handle abort
  50.    if result then
  51.       signal quitit
  52.  
  53.    lister set handle progress count i+1
  54.    lister set handle progress name files.i
  55.    lister query handle entry files.i stem fileinfo.
  56.  
  57.    beginline=left(fileinfo.name,31-length(fileinfo.size))' 'fileinfo.size
  58.  
  59.    thisfile='"'srcpath||fileinfo.name'"'
  60.    ext=reverse(fileinfo.name)
  61.    parse var ext ext '.'
  62.    ext=upper(reverse(ext))
  63.  
  64.    if ext='LHA'|ext='LZH'|ext='RUN' then
  65.       address command 'LhA >NIL: e -q -x0 -Qw -Qo' thisfile 'T: FILE_ID.DIZ'
  66.  
  67.    if ext='LZX' then
  68.       address command 'LZX >NIL: x' thisfile 'FILE_ID.DIZ T:'
  69.  
  70.    if ext='DMS' then
  71.       address command 'DMSDescript >NIL: x T:FILE_ID.DIZ' thisfile
  72.  
  73.    if ext='README' then do  /* Aminet description */
  74.       call open('readme',srcpath||fileinfo.name,'r')
  75.       desc=readln('readme')
  76.       close('readme')
  77.       parse var desc ':' desc
  78.       beginline=beginline strip(desc,'b')
  79.       end
  80.  
  81.    if open('fileid','T:FILE_ID.DIZ','r') then do
  82.       do while ~eof('fileid')
  83.          idline=compress(readln('fileid'),'0d1a'x)
  84.          if ~(idline==''&eof('fileid')) then do
  85.             call writeln('output',beginline idline)
  86.             beginline=copies(' ',32)
  87.             end
  88.          end
  89.       call close('fileid')
  90.       address command 'Delete >NIL: T:FILE_ID.DIZ QUIET'
  91.       end
  92.    else
  93.       call writeln('output',beginline)
  94.  
  95.    lister select handle '"'fileinfo.name'"' off  /* deselect file */
  96.    end
  97.  
  98. signal quitit
  99.  
  100.  
  101. quitit:
  102.  
  103.    lister set handle title    /* reset title text */
  104.    lister refresh handle full
  105.    lister set handle busy off
  106.  
  107.    call close('output')
  108.    command read outfile        /* display generated File ID List */
  109.